package com.iwayin.core.bo.commentditto;

import com.iwayin.core.dao.comment.CommentDAO;
import com.iwayin.core.dao.commentditto.CommentDittoDAO;
import com.iwayin.core.dataobject.CommentDittoDO;

public class CommentDittoBOImpl implements CommentDittoBO {
	private CommentDittoDAO commentDittoDAO;
	private CommentDAO commentDAO;
	@Override
	public void addCommentDitto(CommentDittoDO commentDittoDO) {
		boolean isAddDittoComment =this.commentDittoDAO.isAddDittoComment(commentDittoDO);
		if(!isAddDittoComment){
			this.commentDittoDAO.addCommentDitto(commentDittoDO);
			this.commentDAO.commentDittoPlusOne(commentDittoDO.getCommentId());
		}

	}
	
	@Override
	public void deleteCommentDitto(CommentDittoDO commentDitto) {
		this.commentDittoDAO.deleteCommentDitto(commentDitto);
		this.commentDAO.cancelCommentDitto(commentDitto.getCommentId());
		
	}
	public void setCommentDittoDAO(CommentDittoDAO commentDittoDAO) {
		this.commentDittoDAO = commentDittoDAO;
	}

	public void setCommentDAO(CommentDAO commentDAO) {
		this.commentDAO = commentDAO;
	}
	
}
